#pragma once
#include "MonoODBC.h"



class CMonoCache
{
public:
	CMonoCache();
	~CMonoCache();

public:
	bool	GetCache(SinglePageDataMap& getCache);
	void	AddIntoCache(int iNewPageId, const SinglePageData& newPageData);
	void	ModifyCache(int iModifyPageId, const SinglePageData& newPageData);

private:
	bool	GetAllDataFromDB(Tab1VarMap& tab1VarStructMap, Tab2VarMap& tab2VarStructMap, CList<Tab3ListVarStruct>& tab3ListVarStructList, CList<Tab4ListVarStruct>& tab4ListVarStructList);
	bool	RefreshCache(bool bFromDB = false);
	void	FillIntoCache(Tab1VarMap& tab1VarStructMap, Tab2VarMap& tab2VarStructMap, CList<Tab3ListVarStruct>& tab3ListVarStructList, CList<Tab4ListVarStruct>& tab4ListVarStructList);
	bool	AddIntoDatabase(int keyId, const SinglePageData& pageData);
	bool	ModifyDatabase(int keyId, const Tab1VarStruct& tab1);
	bool	ModifyDatabase(int keyId, const Tab2VarStruct& tab2);

private:
	SinglePageDataMap	m_Cache;
	MonoODBC			m_ODBC;
};
